Skip to content

V2 external memory#139

Open
Dongbumlee wants to merge 9 commits intov2from
v2-external-memory
Open

V2 external memory#139
Dongbumlee wants to merge 9 commits intov2from
v2-external-memory

Conversation

@Dongbumlee
Copy link
Contributor

Purpose

  • Add Qdrant-backed shared memory for cross-agent context sharing across workflow steps (analysis → design → convert → documentation), enabling agents in later steps to access key findings from earlier steps without re-reading blob files
  • Reduce LLM context window usage by 40% (keep_last_messages 50→30) by injecting workspace context (process_id, folder paths) into agent system instructions so they survive context trimming
  • Update deployment infrastructure to provision the text-embedding-3-large model and configure App Configuration with the embedding deployment name
  • Externalize ResultGenerator prompts from inline code to text files for maintainability
  • Fix YAML Expert PENDING sign-off routing and step transition UI display

Does this introduce a breaking change?

  • Yes
  • No

Golden Path Validation

  • I have tested the primary workflows (the "golden path") to ensure they function correctly without errors.

Deployment Validation

  • I have validated the deployment process successfully and all services are running as expected with this change.

What to Check

Verify that the following are valid

  • Shared memory initializes correctly: look for [MEMORY] Workflow-level shared memory store initialized in processor logs
  • Cross-step memory injection: [MEMORY] Injecting N memories for {Agent} appears in design/convert/documentation steps
  • Memory cleanup on workflow completion: [MEMORY] Workflow complete — closing memory store (N memories)
  • All 4 steps complete with PASS sign-offs (analysis, design, yaml, documentation)
  • YAML Expert sign-off is PASS (not PENDING) in file_converting_result.md
  • Step transitions show "Initializing {Step}" briefly before the first Coordinator response
  • Workflow completes in ~17-18 minutes for the EBS-KC test dataset (down from ~19 min baseline)
  • AZURE_OPENAI_EMBEDDING_DEPLOYMENT_NAME is present in App Configuration after Bicep deployment
  • Disabling memory via SHARED_MEMORY_ENABLED=false falls back to original v2 behavior without errors

Other Information

New files:

  • src/processor/src/libs/agent_framework/qdrant_memory_store.py — Qdrant in-process vector store
  • src/processor/src/libs/agent_framework/shared_memory_context_provider.py — ContextProvider for memory injection
  • src/processor/src/steps/*/orchestration/prompt_resultgenerator.txt — Externalized ResultGenerator prompts (4 files)

Configuration:

  • Enabled by default (SHARED_MEMORY_ENABLED=true)
  • Requires AZURE_OPENAI_EMBEDDING_DEPLOYMENT_NAME in App Config (added to Bicep)
  • Gracefully degrades: if embedding deployment is missing, workflow runs without memory (v2 behavior)

Test coverage:

  • 115 unit tests passing (77 original + 38 new for QdrantMemoryStore and SharedMemoryContextProvider)
  • Local E2E: 17m 23s with keep_last_messages=30, all 4 steps PASS, 20 memories across workflow

- QdrantMemoryStore: in-process Qdrant embedded vector store, per-process isolation
- SharedMemoryContextProvider: ContextProvider that reads/writes shared memories
  - invoking(): queries Qdrant for relevant memories before each LLM call
  - invoked(): stores agent responses into shared memory after each LLM call
- OrchestratorBase: auto-initializes memory store + attaches provider to expert agents
- Enabled by default, controlled via SHARED_MEMORY_ENABLED env var
- Requires AZURE_OPENAI_EMBEDDING_DEPLOYMENT_NAME for embedding generation
- mem0_async_memory: reduced max_tokens from 100K to 4K for extraction calls
- All 77 existing tests pass
… tests

- MigrationProcessor: creates QdrantMemoryStore at workflow start, disposes in finally
- Memory persists across all 4 steps (analysis→design→convert→documentation)
- OrchestratorBase: resolves memory from AppContext instead of creating its own
- SharedMemoryContextProvider: fix duck typing for isinstance checks
- 18 tests for QdrantMemoryStore (init, add, search, workflow lifecycle)
- 20 tests for SharedMemoryContextProvider (invoking, invoked, edge cases)
- All 115 tests pass (77 existing + 38 new)
- SharedMemoryContextProvider: log inject count + stored content per agent turn
- MigrationProcessor: log total memory count after each step completes
- Enables real-time monitoring of memory flow across workflow steps
- Fix: use get_bearer_token_provider() instead of async variant (AzureCliCredential await error)
- Add print() statements for memory init diagnostics (embedding deployment found/missing/failed)
- Tested locally: 20 memories across 4 steps, workflow completed successfully in 19m 25s
- Workspace context injected into agent system instructions (never trimmed)
- keep_last_messages reduced 50→20, max_total_chars 600K→400K
- ResultGenerator prompts moved to prompt_resultgenerator.txt (4 steps)
- Step transition phase shows 'Initializing {Step}' instead of step name
- flush_agent_memories() fixed: use agent.context_provider.providers
- Guard against uninitialized store in _flush_memory()
- Same-step memory skip (only search cross-step memories)
- Buffered storage (only last response per agent stored)
- Debug log for memory store resolution per step
- Tested: 17m 23s with keep_last_messages=20, all 4 steps PASS
…WARE ROUTING

- Added rule 6: route to YAML Expert if their sign-off is PENDING before Chief Architect finalizes
- Same pattern as Chief Architect PENDING fix in design coordinator
… UI fixes

- Bicep: add text-embedding-3-large model deployment (capacity 500) alongside GPT5.1
- Bicep: add AZURE_OPENAI_EMBEDDING_DEPLOYMENT_NAME to App Config keys
- mem0_async_memory: replace hardcoded endpoints with env vars (AZURE_OPENAI_*)
- keep_last_messages adjusted 20→30 for analysis step stability
- Analysis executor: phase shows 'Initializing Analysis' instead of 'Analysis'
- Test assertions updated for new phase name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant